<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // const str = "2020-12-21 13:30:20";
      // const [year, month, day] = str.split("-");
      // console.log(year, month, day);
      const date = new Date("2020-12-21 13:30:20");
      console.log("年", date.getFullYear());
      console.log("月", date.getMonth() + 1);
      console.log("日", date.getDate());
      console.log("时", date.getHours());
      console.log("分", date.getMinutes());
      console.log("秒", date.getSeconds());
      console.log("毫秒", date.getMilliseconds());
      console.log("星期", date.getDay());
    </script>
  </body>
</html>
